<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8" />
    <script type="text/javascript">
        function a() {
            var user = "追梦子";
            alert(this.user);
            console.log(this);
        }
    </script>
</head>

<body>
    <button style="position:relative;background:red" onclick="window.a()">点击我</button>

</body>

</html>